﻿using DLL;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace NursingFormSystem
{
    public partial class ChangeEduContent : Form
    {
        public string sql = "";
        public string ProjectGuid = "";
        public ChangeEduContent(string projectguid)
        {
            InitializeComponent();
            ProjectGuid = projectguid;
            sql += "SELECT ProjectContent  FROM [BNNursingDocsSystem_Develop].[dbo].[HealthEduContent](NOLOCK)  as  a  where ProjectGuid =  '" + ProjectGuid + "'   order by id desc";
            object temp = SqlHelper.ExecuteScalar(CommandType.Text, sql);
            if (null != temp)
            {
                textEdit1.Text = temp.ToString();
            }
            else textEdit1.Text = "";
        }

        private void simpleButton2_Click(object sender, EventArgs e)
        {
            DialogResult = System.Windows.Forms.DialogResult.No;
            Close();
        }

        private void simpleButton1_Click(object sender, EventArgs e)
        {
            sql = @" insert into [BNNursingDocsSystem_Develop].[dbo].[HealthEduContent] (ProjectContent,ProjectGuid) values ('" + textEdit1.Text + "','" + ProjectGuid + "')";
            SqlHelper.ExecuteNonQuery(CommandType.Text, sql);
            DialogResult = System.Windows.Forms.DialogResult.OK;
            DevExpress.XtraEditors.XtraMessageBox.Show("保存成功！");
            Close();
        }
    }
}
